package train48days;

import java.util.Scanner;

public class 计算日期到天数的转换 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int year = sc.nextInt();
        int month =sc.nextInt();
        int day =sc.nextInt();
        System.out.println(whatday(year,month,day));
    }

    private static int whatday(int year, int month, int day) {
        int Day [] = {31,28,31,30,31,30,31,31,30,31,30,31};
        int sum=0;
        if (year<=0||month<=0||month>12||day<=0||day>Day[month-1]){
            return -1;
        }
        if (year%4==0&&year%100!=0||year%400==0){
            Day[1]=29;
        }
        for (int i = 0; i < month-1; i++) {
            sum+=Day[i];
        }
        return sum+day;
    }
}
